package de.hhbk.feedbackmodul.beans.sessionscope;

import javax.annotation.PostConstruct;

import de.hhbk.feedbackmodul.beans.applicationscope.ApplicationManagerBean;
import de.hhbk.feedbackmodul.enums.MessageLabel;
import de.hhbk.feedbackmodul.enums.MessageStyle;

public class MainSessionBean{
	
	private ApplicationManagerBean masterBean;
	
	private SessionManagerBean sessionBean;
	
	private boolean surveyOverview;
	private boolean accountManagement;
	private boolean addQuestion;
	private boolean addSurvey;
	private boolean addQuestionSheet;
	private boolean changeQuestion;
	private boolean changeQuestionSheet;
	private boolean changeSurvey;
	private boolean addParticipant;
	private boolean changeParticipant;
	private boolean answerSheetOverview;
	
	private boolean choiceaccountManagement;
	private boolean choiceAnswers;
	private boolean choiceQuestions;
	private boolean choiceQuestionSheets;
	private boolean choiceSurveys;
	private boolean choiceParticipants;
	
	@PostConstruct
	public void init()
	{
		surveyOverview = true;   
		accountManagement = false;
		addQuestion = false;      
		addSurvey = false;        
		addQuestionSheet = false; 
		changeQuestion = false; 
		changeQuestionSheet = false;
		changeSurvey = false;
		addParticipant = false;
		changeParticipant = false;
		answerSheetOverview = false;
		
		choiceaccountManagement = false;
		choiceAnswers = false;          
		choiceQuestions = false;        
		choiceQuestionSheets = false;   
		choiceSurveys = true;          
		choiceParticipants = false;     
	}
	
	/* ACTION */
	
	public void toogleAccountManagement()
	{
		choiceaccountManagement = !choiceaccountManagement;	
	}
	
	public void toogleAnswers()
	{
		choiceAnswers = !choiceAnswers;	
	}
	
	public void toogleQuestions()
	{
		choiceQuestions = !choiceQuestions;	
	}
	
	public void toogleQuestionSheets()
	{
		choiceQuestionSheets = !choiceQuestionSheets;	
	}
	
	public void toogleSurvey()
	{
		choiceSurveys = !choiceSurveys;	
	}
	
	public void toogleParticipants()
	{
		choiceParticipants = !choiceParticipants;	
	}
	
	public String activeAccountManagement()
	{
		setFlagsback();
		accountManagement = true;
		return "ja";
	}
	
	public String activeAddQuestion()
	{
		setFlagsback();
		addQuestion = true;
		return "ja";
	}
	
	public String activeSurveyOverview()
	{
		setFlagsback();
		surveyOverview = true;
		return "ja";
	}
	
	public String activeQuestionView()
	{
		setFlagsback();
		changeQuestion = true;
		return "ja";
	}
	
	public String activeAddQuestionSheetView()
	{
		setFlagsback();
		addQuestionSheet = true;
		return "ja";
	}
	
	public String activeAddSurveyView()
	{
		setFlagsback();
		addSurvey = true;
		return "ja";
	}
	
	public String activeChangeQuestionSheet()
	{
		setFlagsback();
		changeQuestionSheet = true;
		return "ja";
	}
	
	public String activeAddParticipantView()
	{
		setFlagsback();
		addParticipant = true;
		return "ja";
	}
	
	public String activeChangeParticipant()
	{
		setFlagsback();
		changeParticipant = true;
		return "ja";
	}
	
	public String activeChangeSurvey()
	{
		setFlagsback();
		changeSurvey = true;
		return "ja";
	}
	
	public String activeAnswerView()
	{
		setFlagsback();
		answerSheetOverview = true;
		return "ja";
	}
	
	private void setFlagsback()
	{
		surveyOverview = false;   
		accountManagement = false;
		addQuestion = false;      
		addSurvey = false;        
		addQuestionSheet = false; 
		changeQuestion = false; 
		changeQuestionSheet = false;
		changeSurvey = false;
		addParticipant = false;
		changeParticipant = false;
		answerSheetOverview = false;
	}
	
	public String logout()
	{
		sessionBean.setUserinfo(null);
		sessionBean.addMessageParams("erfolgreich ausgeloggt", MessageStyle.info, MessageLabel.info);
		return "ja";
	}
	
	/* GETTER + SETTER */
	
	public SessionManagerBean getSessionBean() {
		return sessionBean;
	}

	public void setSessionBean(SessionManagerBean sessionBean) {
		this.sessionBean = sessionBean;
	}

	public ApplicationManagerBean getMasterBean() {
		return masterBean;
	}

	public void setMasterBean(ApplicationManagerBean masterBean) {
		this.masterBean = masterBean;
	}

	public boolean isSurveyOverview() {
		return surveyOverview;
	}

	public void setSurveyOverview(boolean surveyOverview) {
		this.surveyOverview = surveyOverview;
	}

	public boolean isAccountManagement() {
		return accountManagement;
	}

	public void setAccountManagement(boolean accountManagement) {
		this.accountManagement = accountManagement;
	}

	public boolean isAddQuestion() {
		return addQuestion;
	}

	public void setAddQuestion(boolean addQuestion) {
		this.addQuestion = addQuestion;
	}

	public boolean isAddSurvey() {
		return addSurvey;
	}

	public void setAddSurvey(boolean addSurvey) {
		this.addSurvey = addSurvey;
	}

	public boolean isAddQuestionSheet() {
		return addQuestionSheet;
	}

	public void setAddQuestionSheet(boolean addQuestionSheet) {
		this.addQuestionSheet = addQuestionSheet;
	}

	public boolean isChangeQuestion() {
		return changeQuestion;
	}

	public void setChangeQuestion(boolean changeQuestion) {
		this.changeQuestion = changeQuestion;
	}

	public boolean isChangeQuestionSheet() {
		return changeQuestionSheet;
	}

	public void setChangeQuestionSheet(boolean changeQuestionSheet) {
		this.changeQuestionSheet = changeQuestionSheet;
	}

	public boolean isChangeSurvey() {
		return changeSurvey;
	}

	public void setChangeSurvey(boolean changeSurvey) {
		this.changeSurvey = changeSurvey;
	}

	public boolean isAddParticipant() {
		return addParticipant;
	}

	public void setAddParticipant(boolean addParticipant) {
		this.addParticipant = addParticipant;
	}

	public boolean isChangeParticipant() {
		return changeParticipant;
	}

	public void setChangeParticipant(boolean changeParticipant) {
		this.changeParticipant = changeParticipant;
	}

	public boolean isAnswerSheetOverview() {
		return answerSheetOverview;
	}

	public void setAnswerSheetOverview(boolean answerSheetOverview) {
		this.answerSheetOverview = answerSheetOverview;
	}

	public boolean isChoiceaccountManagement() {
		return choiceaccountManagement;
	}

	public void setChoiceaccountManagement(boolean choiceaccountManagement) {
		this.choiceaccountManagement = choiceaccountManagement;
	}

	public boolean isChoiceAnswers() {
		return choiceAnswers;
	}

	public void setChoiceAnswers(boolean choiceAnswers) {
		this.choiceAnswers = choiceAnswers;
	}

	public boolean isChoiceQuestions() {
		return choiceQuestions;
	}

	public void setChoiceQuestions(boolean choiceQuestions) {
		this.choiceQuestions = choiceQuestions;
	}

	public boolean isChoiceQuestionSheets() {
		return choiceQuestionSheets;
	}

	public void setChoiceQuestionSheets(boolean choiceQuestionSheets) {
		this.choiceQuestionSheets = choiceQuestionSheets;
	}

	public boolean isChoiceSurveys() {
		return choiceSurveys;
	}

	public void setChoiceSurveys(boolean choiceSurveys) {
		this.choiceSurveys = choiceSurveys;
	}

	public boolean isChoiceParticipants() {
		return choiceParticipants;
	}

	public void setChoiceParticipants(boolean choiceParticipants) {
		this.choiceParticipants = choiceParticipants;
	}

}
